/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ResultEditor.AnnotationClasses.Mouse;

import javax.swing.JTree;
import javax.swing.tree.TreePath;

/**
 *
 * @author Chris
 */
public class NodeExpandedListener {

    public NodeExpandedListener (javax.swing.event.TreeExpansionEvent evt, JTree treeview){
        TreePath path = evt.getPath();
        if (path != null) {
            evt.getPath();
            javax.swing.tree.DefaultMutableTreeNode node = (javax.swing.tree.DefaultMutableTreeNode)path.getLastPathComponent();
            if ( node == null )
                return;

            if( node instanceof ResultEditor.AnnotationClasses.Treeview_ClassNode ){
                ResultEditor.AnnotationClasses.Treeview_ClassNode classnode = ( ResultEditor.AnnotationClasses.Treeview_ClassNode ) node;
                String classname = classnode.getText();
                if( classname == null )
                    return;

                classname = classname.trim();

                ResultEditor.AnnotationClasses.Depot classdepot = new  ResultEditor.AnnotationClasses.Depot();
                classdepot.setClassExpanded( classname, true );
            }
        }
    }
}
